home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Missions Cog Script
- #
- # S1L2_doortoggle.cog
- #
- # [TL]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
- #=========================================================
-
- symbols
-
- message startup
- message activate
- message arrived
- message blocked
-
- thing door0 linkid=1
-
- surface switch linkid=2
-
- flex movespeed=8.0
- flex lightvalue=0.5
-
- int doorsector=-1 local
- int numdoors=0 local
- int doorstatus=0 local
- int movestatus=0 local
-
- sound wav0=beep1.wav
- sound locksound=df_door2-3.wav local
-
- end
-
- # ========================================================
- code
- startup:
- doorsector = GetThingSector(door0);
- SectorAdjoins(doorsector, 0);
- SectorLight(doorsector, lightvalue, 0);
- return;
-
- # .......................................................
-
- activate:
- // if (GetWallCel(switch) == 1) return;
-
- if (GetSenderId() == 1)
- {
- PlaySoundLocal(locksound, 1, 0, 0);
- }
- else if (GetSenderId() == 2)
- {
- if (GetCurFrame(door0) == 0)
- {
- call open_door;
- }
- else if (GetCurFrame(door0) == 1)
- {
- call close_door;
- }
- }
- return;
-
- # ......................................................
- arrived:
- if (GetCurFrame(door0) == 0)
- {
- SectorAdjoins(doorsector, 0);
- SetWallCel(switch, 0);
- }
- return;
-
- # ......................................................
-
- blocked:
- call open_door;
- return;
-
- # ......................................................
- open_door:
- SetWallCel(switch,1);
- PlaySoundPos(wav0, SurfaceCenter(switch), 1, -1, -1, 0);
- SectorAdjoins(doorsector, 1);
- MoveToFrame(door0, 1, movespeed);
- return;
-
- # ........................................................
-
- close_door:
- SetWallCel(switch,0);
- PlaySoundPos(wav0, SurfaceCenter(switch), 1, -1, -1, 0);
- MoveToFrame(door0, 0, movespeed);
- return;
-
- end
-